<?php

namespace app\index\controller;

use app\common\controller\Frontend;
use app\common\library\Token;
use think\db;

class Index extends Frontend {

    protected $noNeedLogin = '*';
    protected $noNeedRight = '*';
    protected $layout = '';

    public function _initialize() {
        parent::_initialize();
    }

    public function index() {
        return $this->view->fetch();
    }

    public function news() {
        $newslist = [];
        return jsonp(['newslist' => $newslist, 'new' => count($newslist), 'url' => 'https://www.fastadmin.net?ref=news']);
    }

    public function ad() {
        $id = $this->request->param('id', 0);
        $data = db('Ad')->where(['ad_id' => $id])->find();

        $this->view->assign('title', $data['titile']);
        $this->view->assign('data', $data);
        return $this->view->fetch();
    }

}
